 ListNode* removeElements(ListNode* head, int val) {
        ListNode* cur = head;
        ListNode* del = cur;
        
        while(del){
            if(del->val == val){ // 满足删除节点
                if(del == head){  //如果要删除的是头节点
                    head = head->next;
                    delete del;
                    del = head;
                }else{
                    cur->next = del->next;
                    delete del;
                    del = cur->next;
                }
            }  
            else{
                cur = del;
                del = del->next;
            }
        }
        return head;
    }